'''
Created on Aug 26, 2010

@author: dexen
'''
'''
def map_genotype(genotype):
    
    # 1st is the rotation gene 
    # 2nd to 4th are the programmatic gene level 1
    # 5th to 7th are the length gene for level 1
    # 8th to 10th are the programmatic gene for level 2  
    # 11th is the offset gene for level 2 
    # 12th to 14th are the length genes for level 2 
    # 15th to 17th are the programmatic genes for level 3 
    # 18th to 20th are the length genes for level 3
    # 21th to 44th are the window genes for the building 
    
    rotation = range(0,360, 10)
    lvl1_prog = [1, 2, 3]
    length = range(3, 6)
    length2 = range(4, 7) #area for bigger programmatic spaces
    lvl2_prog = [5, 6, 5]
    lvl3_prog = [5,7,8]
    win_type = [0,1,2]
    variables = []
    num_prog = len(lvl1_prog)
    #rotation gene 
    variables.append(gmap(genotype[0] ,  rotation))
    #lvl1 programmatic genes 
    for cnt in range(num_prog):
        if len(lvl1_prog) == 0:
            pass
        elif cnt > 0 and variables[-1] == 1 and variables[-2] != 2:
            variables.append(2)
            lvl1_prog.remove(2)
        elif cnt > 0 and variables[-1] == 2 and variables[-2] != 1:
            variables.append(1)
            lvl1_prog.remove(1)
        else:
            prog_var = gmap(genotype[cnt + 1] ,  lvl1_prog)
            variables.append(prog_var)
            lvl1_prog.remove(prog_var)
    #lvl1 length genes
    for cnt in range(num_prog):
        if variables[cnt + 1] == 0 or variables[cnt + 1] == 3:
            variables.append(gmap(genotype[cnt + 5] ,  length))
        if variables[cnt + 1] == 1 or variables[cnt + 1] == 2:
            variables.append(gmap(genotype[cnt + 5] ,  length2))
    #lvl2 programmatic space
    for cnt in range(num_prog):
        if len(lvl2_prog) == 0:
            pass
        else:
            prog_var2 = gmap(genotype[cnt + 7] ,  lvl2_prog)
            variables.append(prog_var2)
            lvl2_prog.remove(prog_var2)
    #lvl2 offset gene
    if variables[8] == 6:
        variables.append(0)
    else:
        variables.append(-1)
    #lvl2 length genes
    for cnt in range(num_prog):
        length_void = variables[cnt + 4]
        if variables[cnt + 7] == 6:
            if cnt == 0 or cnt == 1 :
                variables.append(length_void)
            elif cnt == 2 :
                variables.append(length_void + ((variables[10]*1.2)))
        else:
            variables.append(gmap(genotype[cnt + 11] ,  length))
            
    #lvl3 programmatic space
    for cnt in range(num_prog):
        if len(lvl3_prog) == 0:
            pass
        elif cnt > 0 and variables[-1] == 7 and variables[-2] != 8:
            variables.append(8)
            lvl3_prog.remove(8)
        elif cnt > 0 and variables[-1] == 8 and variables[-2] != 7:
            variables.append(7)
            lvl3_prog.remove(7)
        else:
            prog_var3 = gmap(genotype[cnt + 14] ,  lvl3_prog)
            variables.append(prog_var3)
            lvl3_prog.remove(prog_var3)
            
    #lvl3 length genes
    for cnt in range(num_prog):
        variables.append(gmap(genotype[cnt + 17] ,  length))
        
    #input the variables into houdini 
    enableHouModule()
    import hou
    hou.hipFile.load(basefilepath)
    phenotype = hou.node("/obj/geo1/phenotype")
    phenotype.setParms({"rotation": variables[0], "prog1": variables[1], 
                        "prog2": variables[2], "prog3": variables[3],
                        "length1":variables[4],"length2": variables[5], 
                        "length3": variables[6], "offset1": variables[10],
                        "prog4": variables[7], "prog5": variables[8],
                        "prog6": variables[9], "length4": variables[11], 
                        "length5": variables[12],"length6": variables[13],
                        "prog7": variables[14], "prog8": variables[15],
                        "prog9": variables[16], "length7": variables[17],
                        "length8": variables[18], "length9": variables[19]})
    #hou.hipFile.save()
    #windows
    num_windows = 24
    parameters = hou.node("/obj/geo1/parameters")
    for cnt in range(num_windows):
        if cnt < 10:
            variables.append(gmap(genotype[cnt + 20], win_type))
        if cnt == 10 or cnt == 11:
            alength_self = variables[11]
            alength = variables[4]
            width = parameters.evalParm("width1")
            
    return variables
'''
print 4%2